

pd<-paste(wd, "/Appendix_A2/A_output/",sep="")


pdf(file= paste(pd,"region_nocv_plot.pdf",sep=""), 12, 6)


region_nocv<-read.csv(file="results_regionK0.csv")

par(mfrow=c(2,2))
par(oma=c(0,0,2,0) )
par(mar=c(2,4,2,1))

plot(region_nocv$years,region_nocv$pDh_AFR,type="n",lwd=2,col="Dark Blue",axes=F,xlab="",ylab="% Democracies",ylim=c(0,.38))


grid()


polygon(c(2000,2012,2012,2000),c(.0,.0,1,1),col=rgb(.1,.1,.1,.1),border="NA")


lines(region_nocv$years[region_nocv$years < 2001],region_nocv$pDh_AFR[region_nocv$years < 2001],lwd=2,col="Dark Blue")

lines(region_nocv$years[region_nocv$years >= 2001],region_nocv$pDh_AFR[region_nocv$years >= 2001],lwd=2,lty=2,col="Dark Blue")



lines(region_nocv$years,region_nocv$pD_AFR,,lwd=2,col=rgb(.1,.1,.1,.75))


axis(1);axis(2,at=seq(0,1,by=.1),labels=(seq(0,100,by=10)))

mtext("Africa",line=0,font=1,cex=1)



###


plot(region_nocv$years,region_nocv$pDh_ASO,type="n",lwd=2,col="Dark Blue",axes=F,xlab="",ylab="",ylim=c(.12,.4))


grid()


polygon(c(2000,2012,2012,2000),c(.0,.0,1,1),col=rgb(.1,.1,.1,.1),border="NA")


lines(region_nocv$years[region_nocv$years < 2001],region_nocv$pDh_ASO[region_nocv$years < 2001],lwd=2,col="Dark Blue")

lines(region_nocv$years[region_nocv$years >= 2001],region_nocv$pDh_ASO[region_nocv$years >= 2001],lwd=2,lty=2,col="Dark Blue")



lines(region_nocv$years,region_nocv$pD_ASO,,lwd=2,col=rgb(.1,.1,.1,.75))


axis(1);axis(2,at=seq(0,1,by=.1),labels=(seq(0,100,by=10)))

mtext("Asia-Oceania",line=0,font=1,cex=1)





###

plot(region_nocv$years,region_nocv$pDh_EUR,type="n",lwd=2,col="Dark Blue",axes=F,xlab="",ylab="% Democracies",ylim=c(.5,1))


grid()


polygon(c(2000,2012,2012,2000),c(.0,.0,1,1),col=rgb(.1,.1,.1,.1),border="NA")


lines(region_nocv$years[region_nocv$years < 2001],region_nocv$pDh_EUR[region_nocv$years < 2001],lwd=2,col="Dark Blue")

lines(region_nocv$years[region_nocv$years >= 2001],region_nocv$pDh_EUR[region_nocv$years >= 2001],lwd=2,lty=2,col="Dark Blue")



lines(region_nocv$years,region_nocv$pD_EUR,,lwd=2,col=rgb(.1,.1,.1,.75))


axis(1);axis(2,at=seq(0,1,by=.1),labels=(seq(0,100,by=10)))

mtext("Europe",line=0,font=1,cex=1)




###


plot(region_nocv$years,region_nocv$pDh_AME,type="n",lwd=2,col="Dark Blue",axes=F,xlab="",ylab="",ylim=c(.35,.95))


grid()


polygon(c(2000,2012,2012,2000),c(.0,.0,1,1),col=rgb(.1,.1,.1,.1),border="NA")


lines(region_nocv$years[region_nocv$years < 2001],region_nocv$pDh_AME[region_nocv$years < 2001],lwd=2,col="Dark Blue")

lines(region_nocv$years[region_nocv$years >= 2001],region_nocv$pDh_AME[region_nocv$years >= 2001],lwd=2,lty=2,col="Dark Blue")



lines(region_nocv$years,region_nocv$pD_AME,,lwd=2,col=rgb(.1,.1,.1,.75))


axis(1);axis(2,at=seq(0,1,by=.1),labels=(seq(0,100,by=10)))

mtext("Americas",line=0,font=1,cex=1)


mtext("No Covariates",outer=T,side=3,cex=1.5,font=2,line=-.25)


dev.off()


###########################

pdf(file=paste(pd,"region_2cv_plot.pdf",sep=""), 12, 6)


region_2cv<-read.csv(file="results_regionK2.csv")

par(mfrow=c(2,2))
par(oma=c(0,0,2,0) )
par(mar=c(2,4,2,1))

plot(region_2cv$years,region_2cv$pDh_AFR,type="n",lwd=2,col="Dark Blue",axes=F,xlab="",ylab="% Democracies",ylim=c(.0,.38))


grid()


polygon(c(2000,2012,2012,2000),c(.0,.0,1,1),col=rgb(.1,.1,.1,.1),border="NA")


lines(region_2cv$years[region_2cv$years < 2001],region_2cv$pDh_AFR[region_2cv$years < 2001],lwd=2,col="Dark Blue")

lines(region_2cv$years[region_2cv$years >= 2001],region_2cv$pDh_AFR[region_2cv$years >= 2001],lwd=2,lty=2,col="Dark Blue")



lines(region_2cv$years,region_2cv$pD_AFR,,lwd=2,col=rgb(.1,.1,.1,.75))


axis(1);axis(2,at=seq(0,1,by=.1),labels=(seq(0,100,by=10)))

mtext("Africa",line=0,font=1,cex=1)



###


plot(region_2cv$years,region_2cv$pDh_ASO,type="n",lwd=2,col="Dark Blue",axes=F,xlab="",ylab="",ylim=c(.12,.4))


grid()


polygon(c(2000,2012,2012,2000),c(.0,.0,1,1),col=rgb(.1,.1,.1,.1),border="NA")


lines(region_2cv$years[region_2cv$years < 2001],region_2cv$pDh_ASO[region_2cv$years < 2001],lwd=2,col="Dark Blue")

lines(region_2cv$years[region_2cv$years >= 2001],region_2cv$pDh_ASO[region_2cv$years >= 2001],lwd=2,lty=2,col="Dark Blue")



lines(region_2cv$years,region_2cv$pD_ASO,,lwd=2,col=rgb(.1,.1,.1,.75))


axis(1);axis(2,at=seq(0,1,by=.1),labels=(seq(0,100,by=10)))

mtext("Asia-Oceania",line=0,font=1,cex=1)





###

plot(region_2cv$years,region_2cv$pDh_EUR,type="n",lwd=2,col="Dark Blue",axes=F,xlab="",ylab="% Democracies",ylim=c(.5,1))


grid()


polygon(c(2000,2012,2012,2000),c(.0,.0,1,1),col=rgb(.1,.1,.1,.1),border="NA")


lines(region_2cv$years[region_2cv$years < 2001],region_2cv$pDh_EUR[region_2cv$years < 2001],lwd=2,col="Dark Blue")

lines(region_2cv$years[region_2cv$years >= 2001],region_2cv$pDh_EUR[region_2cv$years >= 2001],lwd=2,lty=2,col="Dark Blue")



lines(region_2cv$years,region_2cv$pD_EUR,,lwd=2,col=rgb(.1,.1,.1,.75))


axis(1);axis(2,at=seq(0,1,by=.1),labels=(seq(0,100,by=10)))

mtext("Europe",line=0,font=1,cex=1)




###


plot(region_2cv$years,region_2cv$pDh_AME,type="n",lwd=2,col="Dark Blue",axes=F,xlab="",ylab="",ylim=c(.35,.95))


grid()


polygon(c(2000,2012,2012,2000),c(.0,.0,1,1),col=rgb(.1,.1,.1,.1),border="NA")


lines(region_2cv$years[region_2cv$years < 2001],region_2cv$pDh_AME[region_2cv$years < 2001],lwd=2,col="Dark Blue")

lines(region_2cv$years[region_2cv$years >= 2001],region_2cv$pDh_AME[region_2cv$years >= 2001],lwd=2,lty=2,col="Dark Blue")



lines(region_2cv$years,region_2cv$pD_AME,,lwd=2,col=rgb(.1,.1,.1,.75))


axis(1);axis(2,at=seq(0,1,by=.1),labels=(seq(0,100,by=10)))

mtext("Americas",line=0,font=1,cex=1)


mtext("Two Covariates",outer=T,side=3,cex=1.5,font=2,line=-.25)


dev.off()






